package com.wn.service.impl;

import com.wn.mapper.LogDao;
import com.wn.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogDao logDao;

    /**
     * 事务传播行为:
     *     Propagation.REQUIRES_NEW
     *     如果之前的方法有事务、我单独的开启一个新事物
     * @param out
     * @param in
     * @param money
     */
	@Transactional(propagation = Propagation.REQUIRES_NEW)
    public void log(String out,String in,int money ) {
        logDao.log("转账操作由"+out+"到"+in+",金额："+money);
    }
}